home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / math / newmat08 / boolean.h < prev    next >
C/C++ Source or Header  |  1995-01-11  |  1KB  |  54 lines

  1. //$$ boolean.h                       Boolean class
  2.  
  3. #ifndef Boolean_LIB
  4. #define Boolean_LIB 0
  5. /*class BooleanTRUE
  6. {
  7. public:
  8.     BooleanTRUE() {}
  9.     operator int() const { return 1; }
  10.     int operator! () const { return 0; }
  11.     FREE_CHECK(BooleanTRUE);
  12. };
  13.  
  14. class BooleanFALSE
  15. {
  16. public:
  17.     BooleanFALSE() {}
  18.     operator int() const { return 0; }
  19.     int operator! () const { return 1; }
  20.     FREE_CHECK(BooleanFALSE);
  21. };
  22.  
  23. const BooleanTRUE TRUE;
  24. const BooleanFALSE FALSE;
  25. */
  26.  
  27. class Boolean
  28. {
  29.     int value;
  30. public:
  31.     Boolean(const int b) { value = b ? 1 : 0; }
  32.     Boolean(const void* b) { value = b ? 1 : 0; }
  33.     Boolean() {}
  34. //    Boolean(const BooleanTRUE) : value(1) {}
  35. //    Boolean(const BooleanFALSE) : value(0) {}
  36.     operator int() const { return value; }
  37.     int operator!() const { return !value; }
  38. //    void operator=(const BooleanTRUE) { value=1; }
  39. //    void operator=(const BooleanFALSE) { value=0; }
  40.     FREE_CHECK(Boolean);
  41. };
  42.  
  43.  
  44. const Boolean TRUE = 1;
  45. const Boolean FALSE = 0;
  46.  
  47.  
  48.  
  49. // version for some older versions of gnu g++
  50. //#define FALSE 0
  51. //#define TRUE 1
  52.  
  53. #endif
  54.